﻿@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
    Layout = null;
}
<link href="~/lib/layui/css/layui.css" rel="stylesheet" />
@* <script src="~/lib/layui/layui.js"></script> *@
<script src="~/js/js.cookie.js"></script>
<script src="~/js/moment.js"></script>
<script src="~/lib/jquery/dist/jquery.js"></script>
@* 导出引入文件 *@
<title>Layui with XLSX</title>
<!-- 引入Layui的CSS -->
@* <link rel="stylesheet" href="path/to/layui.css"> *@
<!-- 引入XLSX库的CDN -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>



<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>采购入库列表</title>
    <link href="//unpkg.com/layui@2.9.18/dist/css/layui.css" rel="stylesheet">
</head>
<body>
    <form class="layui-form" action="">
        <div class="layui-form">
            <div class="layui-form-item">
                <div class="layui-input-group">
                    <div class="layui-input-prefix">
                        入库单编号
                    </div>
                    <div>
                        <input id="PurchaseNos" type="text" placeholder="请输入入库单编号" class="layui-input">
                    </div>

                    <div class="layui-input-prefix" style="left:50px">
                        入库单名称
                    </div>
                    <div style="left:50px">
                        <input id="PurchaseName" type="text" placeholder="请输入入库单名称" class="layui-input">
                    </div>

                    <div class="layui-input-prefix" style="left:100px">
                        供应商名称
                    </div>
                    <div style="left:100px">
                        <input id="SupplierName" type="text" placeholder="请输入供应商名称" class="layui-input">
                    </div>
                </div>
            </div>
        </div>
            <div class="layui-form-item">
                <div class="layui-input-group">
                    <div class="layui-input-prefix" style="left:14px">
                        订单编号
                    </div>
                    <dic style="left:14px">
                    <input id="PurchaseIndentId" type="text" placeholder="请输入订单编号" class="layui-input">
                    </dic>

                    <div class="layui-input-prefix" style="left:14px">
                        入库时间
                    </div>
                <dic style="left:14px">
                    <input style="width:198px" id="PurchaseDate" type="date" placeholder="请输入入库时间" class="layui-input">
                </dic>

                    <div style="left:20px">
                    <button onclick="ShowSellStock()" id="searchBtn" type="button" class="layui-btn layui-btn-normal">搜索</button>

                    </div>
                <div style="right:-20px">
                    <button type="button" class="layui-btn demo-class-accept" lay-options="{accept: 'file'}" style="left:10px">
                        <i class="layui-icon layui-icon-upload"></i>
                        上传文件
                    </button>
                    <button  type="button" class="layui-btn layui-bg-blue">导出</button>

                </div>
                </div>
            </div>
        
            <div class="layui-form-item">
                <div class="layui-input-group">
                    <div>
                        <button type="button" class="layui-btn layui-btn-sm layui-btn-primary layui-border-blue" lay-on="test-page-custom">
                            <i class="layui-icon layui-icon-add-1">新增</i>
                        </button>
                </div>
            </div>

            <table style="left:320px" class="layui-table">
                <thead>
                    <tr>
                        <td><input type="checkbox" id="quanxuan" onclick="xuanzhe()" value="" /></td>
                        <td>入库单编号</td>
                        <td>入库单名称</td>
                        <td>供应商名称</td>
                        <td>入库时间</td>
                        <td>采购订单号</td>
                        <td>单据状态</td>
                        <td>操作</td>
                    </tr>
                </thead>
                <tbody></tbody>
            </table>
            <div id="demo-laypage-all"></div>
        </div>
    </form>
    <script src="//unpkg.com/layui@2.9.18/dist/layui.js"></script>
    <script>
        var $ = layui.$;
        var layer = layui.layer;
        var util = layui.util;
        var form = layui.form;
        layui.use(function () {
            // 事件
            util.on('lay-on', {
                'test-page-custom': function () {
                    layer.open({
                        type: 1,
                        area: '100%',
                        resize: false,
                        shadeClose: true,
                        title: '添加物料入库单',
                        content: `
                                <form class="layui-form" action="">
                                  <div class="layui-form" lay-filter="filter-test-layer" style="margin: 16px;">
                                   <div class="demo-login-container">
                                   <div class="layui-form-item">
                                   <div class="layui-input-group">
                                   <div class="layui-input-prefix" style="left:28px">
                                入库单编码
                                   </div>

                                  <div style="width:400px;left:28px">
                                          <input style="width:400px" type="text" name="PurchaseNo" value="" lay-verify="required" placeholder="请输入入库单编码" lay-reqtext="请填写入库单编码" autocomplete="off" class="layui-input" lay-affix="clear">
                                     </div>
                                      <div style="left:27px">
                                      <button type="button" class="layui-btn layui-btn-primary layui-btn-xs" onclick="nodeAlls()">自动生成</button>
                                      </div>
                                     </div>
                                     </div>
                                    <div class="layui-form-item">
                                    <div class="layui-input-group">
                                    <div class="layui-input-prefix" style="left:28px">
                                      入库单名称
                                    </div>
                                   <div style="width:500px;left:28px">
                                            <input style="width:500px" type="text" name="PurchaseName" value="" lay-verify="required" placeholder="请输入入库单名称" lay-reqtext="请填写 入库单名称" autocomplete="off" class="layui-input" lay-affix="clear">
                                   </div>
                                    </div>
                                    </div>

                                   <div class="layui-form-item">
                                   <div class="layui-input-group">
                                  <div class="layui-input-prefix" style="left:28px">
                                    入库时间
                                    </div>
                                    <div style="width:220px;left:28px">
                                                     <input style="width:210px" type="date" name="PurchaseDate" value="" lay-verify="required" placeholder="请输入出库日期" lay-reqtext="请填写出库日期" autocomplete="off" class="layui-input" lay-affix="clear">
                                      </div>
                                   
                                  </div>
                                  </div>

                                  
                                   <div class="layui-form-item">
                                   <div class="layui-input-group">
                                   <div class="layui-input-prefix" style="left:28px">
                                     到货通知单
                                  </div>
                                  <div style="width:150px;left:28px">
                                                  <input style="width:150px" type="text" name="ArrivalNoticeNo" value="" lay-verify="required" placeholder="请输入到货通知单" lay-reqtext="请填写到货通知单" autocomplete="off" class="layui-input" lay-affix="clear">
                                   </div>
                                  <div style="left:19px">
                                   <button type="button" class="layui-btn layui-btn-primary" lay-on="test-page-customes">
                                   <i class="layui-icon layui-icon-search"></i>
                                   </button>
                                   </div>
                                   </div>
                                   </div>

                                   <div class="layui-form-item">
                                   <div class="layui-input-group">
                                     <div class="layui-input-prefix" style="left:28px">
                                               采购订单号
                                      </div>
                                       <div style="width:500px;left:28px">
                                                <input style="width:500px" type="text" name="PurchaseIndentId" value="" lay-verify="required" placeholder="请输入采购订单号" lay-reqtext="请填写采购订单号" autocomplete="off" class="layui-input" lay-affix="clear">
                                         </div>
                                      </div>
                                  </div>

                                         <div class="layui-input-group">
                                           <div class="layui-input-prefix" style="left:28px">
                                             供应商
                                          </div>
                                           <div style="width:150px;left:28px">
                                                           <input style="width:150px" type="text" name="supplierNames" value="" lay-verify="required" placeholder="请输入供应商" lay-reqtext="请填写供应商" autocomplete="off" class="layui-input" lay-affix="clear">
                                           </div>
                                          <div style="left:19px">
                                            <button type="button" class="layui-btn layui-btn-primary" lay-on="test-page-customs">
                                            <i class="layui-icon layui-icon-search"></i>
                                          </button>
                                          </div>
                                           </div>
                                           </div>

                                  <div class="layui-form-item">
                                      <div class="layui-input-group">
                                          <div class="layui-input-prefix" style="left:28px">
                                              备注
                                          </div>
                                          <div style="width:300px;left:28px">
                                                   <textarea style="width:400px" type="textarea" name="Remark" value="" lay-verify="required" placeholder="请输入备注" lay-reqtext="请填写备注" autocomplete="off" class="layui-input layui-textarea" lay-affix="clear"></textarea>
                                            </div>
                                        </div>
                                    </div>

                                             <div class="layui-form-item">
                                          <div class="layui-input-group">
                                    <div class="layui-form-item" style="left:200px">
                                        <button class="layui-btn layui-btn-normal" lay-submit lay-filter="demo-login">新增</button>
                                        <button class="layui-btn layui-btn-primary"  lay-filter="demo-Break">取消</button>
                                          </div>
                                      </div>
                                      </div>
                                      </form>
                                  `,
                        success: function () {
                          
                            // 对弹层中的表单进行初始化渲染
                            form.render();
                            // 表单提交事件
                            form.on('submit(demo-login)', function (data) {
                                var field = data.field; // 获取表单字段值
                                //获取name数据
                                let first = {
                                    purchaseNo: $("[name='PurchaseNo']").val(),
                                    purchaseName: $("[name='PurchaseName']").val(),
                                    purchaseDate: $("[name='PurchaseDate']").val(),
                                    arrivalNoticeNo: $("[name='ArrivalNoticeNo']").val(),
                                    purchaseIndentId: $("[name='PurchaseIndentId']").val(),
                                    supplierId: localStorage.getItem("supplierId"),
                                    remark: $("[name='Remark']").val(),
                                    ReceiptState: "草稿"
                                };
                                console.log("!!!");
                                // 显示填写结果，仅作演示用
                                layer.alert(JSON.stringify(field), {
                                    title: '当前填写的字段值'
                                });
                                // 此处可执行 Ajax 等操作
                                // …
                                $.ajax({
                                    url: '@ViewBag.FoundationWrite' + '/api/Jocker/PurchaseStorageAdd',
                                    data: JSON.stringify(first),
                                    type: "post",
                                    async: true,
                                    dataType: "json",
                                    contentType: "application/json",
                                    success: res => {
                                        if (res.code > 0) {
                                            layer.msg('新增成功');
                                            console.log('新增成功');
                                            layer.closeAll(); // 关闭当前弹层
                                        }
                                        else {
                                            layer.msg('新增失败');
                                            console.log('新增失败');
                                        }
                                    }
                                })
                                return false; // 阻止默认 form 跳转
                            });
                        }
                    });
                }
            })
        });
        //自动生成编码
        function nodeAlls() {
            var datec = new Date()
            var year = datec.getFullYear();
            var month = (datec.getMonth() + 1).toString().padStart(2, "0")
            var date = (datec.getDate() + 1).toString().padStart(2, "0")
            var hours = datec.getHours()
            var minute = (datec.getMinutes()).toString().padStart(2, "0")
            var seconds = (datec.getSeconds()).toString().padStart(2, "0")
            // var Encoding = "IF";
            var result = "IF" + year + month + date + hours + minute + seconds;
            console.log(result);
            $("[name='PurchaseNo']").val(result);

            //重新渲染表单
            form.render();
        }
    </script>
    <script>
        var $ = layui.$;
        var layer = layui.layer;
        var util = layui.util;
        var form = layui.form;
        layui.use(function () {
            // 事件
            util.on('lay-on', {
                'test-page-customs': function () {
                    layer.open({
                        type: 1,
                        area: '100%',
                        resize: false,
                        shadeClose: true,
                        title: '供应商',
                        content: `
                                <form class="layui-form" action="">
                <div class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-input-group">
                            <div class="layui-input-prefix">
                                供应商编码
                            </div>
                            <div>
                                <input id="supplierNo" type="text" placeholder="请输入供应商编码" class="layui-input">
                            </div>

                            <div class="layui-input-prefix" style="left:50px">
                                供应商名称
                            </div>
                            <div style="left:50px">
                                <input id="supplierName" type="text" placeholder="请输入供应商名称" class="layui-input">
                            </div>

                            <div class="layui-input-prefix" style="left:100px">
                                供应商简称
                            </div>
                            <div style="left:100px">
                                <input id="supplierShort" type="text" placeholder="请输入供应商简称" class="layui-input">
                            </div>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <div class="layui-input-group">
                            <div class="layui-input-prefix" style="left:14px">
                                英文名称
                            </div>
                            <dic style="left:14px">
                                <input id="supplierEnglishName" type="text" placeholder="请输入供应商英文名称" class="layui-input">
                            </dic>

                            <div class="layui-input-prefix" style="left:77px">
                                是否启用
                            </div>
                            <div style="left:77px;width:197px">
                                <select id="supplierIsNo" lay-filter="testSelect">
                                    <option value="-1">是否启用</option>
                                    <option value="0">禁用</option>
                                    <option value="1">启用</option>
                                </select>
                            </div>

                            <div style="left:150px">
                                <button onclick="ShowSupplier()" id="searchBtn" type="button" class="layui-btn layui-btn-normal">搜索</button>

                            </div>

                            <div style="left:170px">
                                <button onclick="Break()" type="button" class="layui-btn layui-btn-primary">重置</button>
                            </div>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <div class="layui-input-group">
                            <div>
                                <button type="button" class="layui-btn layui-btn-sm layui-btn-primary layui-border-blue" lay-on="test-page-custom">
                                    <i class="layui-icon layui-icon-add-1">新增</i>
                                </button>
                            </div>
                        </div>
                    </div>

                    <table style="left:320px" class="layui-table">
                        <thead>
                            <tr>
                                <td>供应商编码</td>
                                <td>供应商名称</td>
                                <td>供应商简称</td>
                                <td>供应商等级</td>
                                <td>供应商评分</td>
                                <td>供应商电话</td>
                                <td>是否启用</td>
                                <td>备注</td>
                                <td>操作</td>
                            </tr>
                        </thead>
                                <tbody id="ClientTable"></tbody>
                    </table>
                    <div id="demo-laypage-all"></div>
                </div>
            </form>
            `,
              success: function () {
                            var form = layui.form;
                            var laypage = layui.laypage;
                            var layer = layui.layer;
                            var $ = layui.$;
                            var laydate = layui.laydate;
                            var util = layui.util;

                            var pageIndex = 1;
                            var pageSize = 2;

                            $(function () {
                                ShowSupplier(pageIndex, pageSize);
                            })
                            // 获取供应商编码
                            $('#searchBtn').click(function () {
                                var supplier = $('#supplierNo').val();
                                ShowSupplier(pageIndex, pageSize)
                            });
                            // 获取供应商名称
                            $('#searchBtn').click(function () {
                                var supplier1 = $('#supplierName').val();
                                ShowSupplier(pageIndex, pageSize)
                            });
                            //供应商简称
                            $('#searchBtn').click(function () {
                                var supplier2 = $('#supplierShort').val();
                                ShowSupplier(pageIndex, pageSize)
                            });
                            // 英文名称
                            $('#searchBtn').click(function () {
                                var supplier2 = $('#supplierEnglishName').val();
                                ShowSupplier(pageIndex, pageSize)
                            });
                            //是否启用
                            form.on('select(testSelect)', function (data) {
                                ShowPermission(data.value); // data.value
                            });
                            //供应商管理列表
                            function ShowSupplier(index, size) {
                                var supplierNo = $("#supplierNo").val() || "";
                                var supplierName = $("#supplierName").val() || "";
                                var supplierShort = $("#supplierShort").val() || "";
                                var supplierEnglishName = $("#supplierEnglishName").val() || "";
                                var supplierIsNo = $("#supplierIsNo").val() || -1;
                                $.ajax({
                                    url: '@ViewBag.FoundationRead' + "/api/UserLi/SearchSupplier",
                                    data: JSON.stringify({ supplierNo: supplierNo, supplierName: supplierName, supplierShort: supplierShort, supplierEnglishName: supplierEnglishName, supplierIsNo: supplierIsNo, pageIndex: index, pageSize: size }),
                                    type: "post",
                                    async: false,
                                    dataType: "json",
                                    contentType: "application/json",
                                    success: res => {
                                        var tbody = $("tbody");
                                        tbody.empty();
                                        if (res.data != null) {
                                            $.each(res.data, function () {
                                                tbody.append(`<tr>
                                        <td>${this.supplierNo}</td>
                                        <td>${this.supplierName}</td>
                                        <td>${this.supplierShort}</td>
                                        <td>${this.supplierClassName}</td>
                                        <td>${this.supplieScore}</td>
                                        <td>${this.supplierPhone}</td>
                                        <td>${this.supplierIsNo === 1 ? '启用' : '禁用'}</td>
                                        <td>${this.supplierRemark}</td>
                                    <td><a onclick="GetClient(${this.supplierId},'${this.supplierNo}','${this.supplierName}')" class="btn btn-link">选择</a></td>
                                    </tr>`);
                                            });
                                        }
                                        form.render(); // 重新渲染下拉框
                                        //完整显示
                                        laypage.render({
                                            elem: 'demo-laypage-all', // 元素 id
                                            count: res.totalCount, // 数据总数
                                            curr: index,//当前页
                                            limit: size,//每页几条
                                            limits: [2, 3, 4],
                                            layout: ['count', 'prev', 'page', 'next', 'limit', 'refresh', 'skip'], // 功能布局
                                            jump: function (obj, first) {
                                                if (!first) {
                                                    ShowSupplier(obj.curr, obj.limit);
                                                }
                                            }
                                        });
                                    }
                                }) 
                            }
                            // 对弹层中的表单进行初始化渲染
                            form.render();
                            // 表单提交事件
                            form.on('submit(demo-Search)', function (data) {
                                var field = data.field; // 获取表单字段值

                                // 显示填写结果，仅作演示用
                                // layer.alert(JSON.stringify(field), {
                                //     title: '当前填写的字段值'
                                // });
                                // 此处可执行 Ajax 等操作
                                // …

                                return false; // 阻止默认 form 跳转
                            });
                                   }
                    });
                }
            })
        });
        function GetClient(supplierId, supplierNo, supplierName) {
            localStorage.setItem("supplierId", supplierId);
            $("[name='supplierNos']").val(supplierNo);
            $("[name='supplierNames']").val(supplierName);
            layer.close(layer.index); // 关闭弹层
            form.render(); // 重新渲染
        }
    </script>
        <script>
        function EditSupplier(purchaseId, purchaseNo) {
        localStorage['purchaseId']=purchaseId;
        localStorage['purchaseNo']=purchaseNo;
            // 事件
            util.on('lay-on', {
                'test-page-customse': function () {
                    layer.open({
                        type: 2,
                        area: ['1200px','600px'],
                        maxmin: true,
                        shadeClose: true,
                        title: '采购入库修改',
                        content: `/Enterprise/PurchaseStorageUpdate`,
                    });
                }
            });
       
        }

    </script>
    <script>
        layui.use(['form', 'laydate', 'util', 'table'], function () {
            var form = layui.form;
            var laypage = layui.laypage;
            var layer = layui.layer;
            var $ = layui.$;
            var laydate = layui.laydate;
            var util = layui.util;

            var pageIndex = 1;
            var pageSize = 2;
            $(function () {
                ShowSellStock(pageIndex, pageSize);
                // 绑定全选和反选事件
                form.on('checkbox(checkAll)', function (data) {
                    if (data.elem.name === 'checkAll') {
                        checkAll();
                    }
                });
                form.on('checkbox(check)', function (data) {
                    if (data.elem.name === 'check') {
                        checkfan();
                    }
                });
            });
            function checkAll() {
                var check = $("[name='check']:eq(0)").prop("checked");
                $("[name='checkAll']:gt(0)").prop("checked", check);
                console.log(check + "123321")

            }
            function checkfan() {
                var length1 = $("[name='check']:gt(0)").length
                var length2 = $("[name='check']:gt(0):checked").length
                var check = lengthl == length2;
                $("[name='checkAll']:eq(0)").prop("checked", check)

            }

            // 采购单编号
            $('#searchBtn').click(function () {
                var sellstock = $('#PurchaseNo').val();
                ShowSellStock(pageIndex, pageSize)
            });
            // 入库名称
            $('#searchBtn').click(function () {
                var sellstock1 = $('#PurchaseName').val();
                ShowSellStock(pageIndex, pageSize)
            });
            //供应商名称
            $('#searchBtn').click(function () {
                var sellstock2 = $('#SupplierName').val();
                ShowSellStock(pageIndex, pageSize)
            });
            // 订单编号
            $('#searchBtn').click(function () {
                var sellstock = $('#PurchaseIndentId').val();
                ShowSellStock(pageIndex, pageSize)
            });
            // 入库时间
            $('#searchBtn').click(function () {
                var sellstock2 = $('#PurchaseDate').val();
                ShowSellStock(pageIndex, pageSize)
            });

            //销售出库单
            function ShowSellStock(index, size) {
                var table = document.querySelector("table.layui-table tbody");
                let data = {
                    purchaseNo: $("#PurchaseNos").val(),
                    purchaseName: $("#PurchaseName").val() || "",
                    supplierName: $("#SupplierName").val() || "",
                    purchaseIndentId: $("#PurchaseIndentId").val() || 0,
                    purchaseDate: $("#PurchaseDate").val() || null,
                    pageIndex: index,
                    pageSize: size
                }
                console.log(typeof (data.purchaseNo))
                console.log(data)
                $.ajax({
                    url: '@ViewBag.FoundationWrite' + "/api/Jocker/PurchaseStorageList",
                    data: JSON.stringify(data),
                    type: "post",
                    dataType: "json",
                    contentType: "application/json",
                    success: res => {
                        var tbody = $("tbody");
                        tbody.empty();
                        console.log(res.data)
                        if (res.data != null) {
                            $.each(res.data, function () {
                                console.log(res.data)
                                tbody.append(`<tr>
                                         <td><input type="checkbox" class="checked" value="${this.purchaseId}" name="check"/></td>
                                         <td>${this.purchaseNo}</td>
                                         <td>${this.purchaseName}</td>
                                         <td>${this.supplierName}</td>
                                         <td>${this.purchaseDate.substr(0, 10).toString("yyyy-MM-dd")}</td>
                                         <td>${this.purchaseIndentId}</td>
                                         <td>${this.receiptState}</td>
                                         <td>
                                         <a onclick="EditSupplier('${this.purchaseId}','${this.purchaseNo}')" class="btn btn-link layui-btn-xs" lay-on="test-page-customse"">修改</a>
                                         <a onclick="Execute('${this.purchaseNo}')" class="btn btn-link">执行入库</a>
                                         </td> </tr>`)

                            });
                            form.render(); // 重新渲染下拉框
                            laypage.render({
                                elem: 'demo-laypage-all', // 元素 id
                                count: res.totalCount, // 数据总数
                                curr: index,//当前页
                                limit: size,//每页几条
                                limits: [2, 3, 4],
                                layout: ['count', 'prev', 'page', 'next', 'limit', 'refresh', 'skip'], // 功能布局
                                jump: function (obj, first) {
                                    if (!first) {
                                        ShowSellStock(obj.curr, obj.limit);
                                    }
                                }
                            });
                        }
                    }
                });
            }



            //导出
            function exportTableToExcel() {
                var table = document.querySelector("table.layui-table tbody");
                var ws = XLSX.utils.table_to_sheet(table);
                var wb = XLSX.utils.book_new();
                XLSX.utils.book_append_sheet(wb, ws, "Sheet1");
                XLSX.writeFile(wb, "工作中心列表.xlsx");
            }

            document.querySelector(".layui-btn.layui-bg-blue").addEventListener("click", exportTableToExcel);

        })
         function Execute(purchaseNo) {
          var datec = new Date()
        var year = datec.getFullYear();
        var month = (datec.getMonth() + 1).toString().padStart(2, "0")
        var date = (datec.getDate() + 1).toString().padStart(2, "0")
        var hours = datec.getHours()
        var minute = (datec.getMinutes()).toString().padStart(2, "0")
        var seconds = (datec.getSeconds()).toString().padStart(2, "0")
        // var Encoding = "IF";
        var result = "CK" + year + month + date + hours + minute + seconds;
        //出库前友好提示
        if (confirm("确定出库吗?")) {
            var data = {
                purchaseNo: purchaseNo,
            }
            $.ajax({
                url: '@ViewBag.FoundationWrite' + "/api/Jocker/Execute",
                data: JSON.stringify(data),
                type: 'post',
                async: false,
                dataType: 'json',
                contentType: 'application/json',
                success: res => {
                    if (res.code > 0) {
                        alert("入库成功");
                        location.reload();
                    }
                    else {
                        alert("入库失败");
                    }
                }
            });
        };
        }

    </script>
    <script>
        layui.use(function () {
            var upload = layui.upload;
            var layer = layui.layer;
            // 渲染
            upload.render({
                elem: '.demo-class-accept', // 绑定多个元素
                url: '@ViewBag.FoundationWrite' + "/api/Jocker/ImportPurchaseStorage",  // 此处配置你自己的上传接口即可
                accept: 'file', // 普通文件
                done: function (res) {
                    layer.msg('上传成功');
                    console.log(res);
                }
            });
        });
        
    </script>
</body>
</html>

    
